package com.itmuch.cloud;

import javax.servlet.http.HttpServletRequest;

import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;

//zuul的过滤器
public class PreZuulFilter extends ZuulFilter{
	
	//逻辑代码
	@Override
	public Object run() {
		HttpServletRequest request = RequestContext.getCurrentContext().getRequest();
		String remoteHost = request.getRemoteHost();
		System.out.println("remoteHost:"+remoteHost);
		return remoteHost;
	}


	//是否执行过滤器
	@Override
	public boolean shouldFilter() {
	
		return true;
	}

	
	//执行的顺序
	@Override
	public int filterOrder() {
		// TODO Auto-generated method stub
		return 1;
	}

	//过滤的类型
	@Override
	public String filterType() {
		// TODO Auto-generated method stub
		return "pre";
	}

}
